package com.jeesite.modules.stock.web;

import java.util.List;

import com.jeesite.common.web.ResponseData;
import com.jeesite.common.web.ResponseDataList;
import com.jeesite.modules.stock.dto.vo.PatternDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jeesite.modules.stock.dto.vo.KLineDataVO;
import com.jeesite.modules.stock.dto.vo.StockRsStrongVO;
import com.jeesite.modules.stock.service.KlineDataService;

@RestController
@RequestMapping("${adminPath}/stock/kline")
public class KLineController {

    @Autowired
    private KlineDataService klineDataService;

    /**
     * 获取股票K线数据
     *
     * @param stockCode 股票代码
     * @param period    日（Day）周(Week) 月（Month）
     */
    @GetMapping("getStockKlineData/{stockCode}/{period}")
    public ResponseData<List<KLineDataVO>> getStockKlineData(@PathVariable String stockCode,
                                                             @PathVariable String period, String startDate, String endDate) {
        return klineDataService.getStockKlineDatas(stockCode, period, startDate, endDate);
    }

    @GetMapping("getStockRsStrong/{stockCode}/{period}")
    public List<StockRsStrongVO> getStockRsStrong(@PathVariable String stockCode, @PathVariable String period) {
        return klineDataService.getStockRsStrong(stockCode, period);
    }

    @GetMapping("getStockPatternData/{stockCode}")
    public PatternDataVO getStockPatternData(@PathVariable String stockCode) {
        return klineDataService.getStockPatternData(stockCode);
    }

    /**
     * 获取板块K线数据
     *
     * @param sectorName 板块名称
     * @param period     周期
     * @param startDate  查询开始日期
     * @param endDate    查询结束日期
     * @return K线数据
     */
    @GetMapping("getSectorKlineData/{sectorName}/{period}")
    public ResponseData<List<KLineDataVO>> getSectorKlineData(@PathVariable String sectorName,
                                                              @PathVariable String period, String startDate, String endDate) {
        return klineDataService.getSectorKlineDatas(sectorName, period, startDate, endDate);
    }
}
